// run: $exec < input
#include <iostream>

int const maxn = 8007;
int a[maxn];
int count[3 * maxn];
int n;

int main()
{
	std::ios::sync_with_stdio(false);
	while (std::cin >> n) {
		for (int i = 0; i < n; i++) std::cin >> a[i];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j <= 2 * n + 1; j++) count[j] = 0;
			int sum = 0;
			int ans = 1;
			for (int j = i - 1; j >= 0; j--) {
				if (a[j] > a[i]) sum--;
				else sum++;
				count[sum + n]++;
				if (!sum) ans++;
			}
			sum = 0;
			for (int j = i + 1; j < n; j++) {
				if (a[j] > a[i]) sum--;
				else sum++;
				ans += count[n - sum];
				if (!sum) ans++;
			}
			if (i) std::cout << ' ' << ans;
			else std::cout << ans;
		}
		std::cout << '\n';
	}
}

